package cn.com.xinjinfu.pdoulcProduct.activity.recharge;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;

import cn.com.xinjinfu.pdoulcProduct.R;
import cn.com.xinjinfu.pdoulcProduct.activity.base.BaseActivity;
import cn.com.xinjinfu.pdoulcProduct.activity.user.MyInvestListAct;
import cn.com.xinjinfu.pdoulcProduct.manager.ActivityManager;
import cn.com.xinjinfu.pdoulcProduct.utils.ReloadUserInfo;

/**
 * Created by android-adt on 2016/1/26.
 */
public class FixedBuyFailAct extends BaseActivity {

    private final String ACTION_NAME = "跳转首页广播";
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.act_fixed_buy_fail);
        ActivityManager.getInstance().addActivity(this);
        findViewById(R.id.bt_touzi).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ActivityManager.getInstance().exitActivity();
                Intent mIntent = new Intent(ACTION_NAME);
                mIntent.putExtra("yaner", "shouye");
                //发送广播
                sendBroadcast(mIntent);
            }
        });
        findViewById(R.id.bt_dingqi).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ActivityManager.getInstance().exitActivity();
                Intent intent = new Intent(FixedBuyFailAct.this, MyInvestListAct.class);
                Bundle mBundle = new Bundle();
                mBundle.putInt("xItem", 1);//直接到投标中列表
                intent.putExtras(mBundle);
                startActivity(intent);
            }
        });
        /**延时3秒*/
        new Handler(new Handler.Callback() {
            @Override
            public boolean handleMessage(Message msg) {
                new ReloadUserInfo(FixedBuyFailAct.this).userRequest();
                return true;
            }
        }).sendEmptyMessageDelayed(0, 1500);
    }

    /**
     *物理返回键
     */
    @Override
    public void onBackPressed() {
        ActivityManager.getInstance().exitActivity();
        Intent mIntent = new Intent(ACTION_NAME);
        mIntent.putExtra("yaner", "shouye");
        //发送广播
        sendBroadcast(mIntent);
    }
}